package com.example.testscalaandroid2.act

import android.app.Activity
import org.scaloid.common.SActivity
import org.scaloid.common.SButton
import org.scaloid.common.SVerticalLayout
import org.scaloid.common._
import android.app.Notification
import android.app.PendingIntent
import android.view.View
import android.net.Uri
import android.R

class Tongzi extends SActivity {
  onCreate {
    contentView = new SVerticalLayout {
      SButton("notify", { v: View =>
        //vibrator

        val notification = new Notification(R.drawable.bottom_bar, null, System.currentTimeMillis())
        notification.defaults = Notification.DEFAULT_SOUND
        notification.setLatestEventInfo(Tongzi.this,
          "tongziTitle", "tongziTxt", PendingIntent.getActivity(Tongzi.this, 0, getIntent(), 0))
        notificationManager.notify(0, notification)
      })

      SButton("alert", { v: View =>
        new AlertDialogBuilder("title", "txt") {
          neutralButton(onClick = { openUri(Uri.parse("http://baidu.com")) })
          negativeButton()
        }.show()
      })
    }
  }
}

